package site.luojie.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import site.luojie.pojo.Article;
import site.luojie.repository.ArticleRepository;
import site.luojie.service.ArticleService;

/**
 * @Description: 文章业务
 * @Author jie.luo
 * @Create: 2020-06-02 22:55
 **/
@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleRepository articleRepository;

    @Override
    public Page<Article> page(Integer page, Integer size) {

        PageRequest pageRequest = PageRequest.of(page, size);
        Page<Article> articlePage = articleRepository.findAll(pageRequest);

        return articlePage;
    }
}
